﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<OverviewModel>" Title="Overview" %>
<%@ Import Namespace="Krystalware.SlickUpload" %>
<asp:Content ContentPlaceHolderID="content" runat="server">
    <h2>
        Upload Result</h2>
    <% if (Model != null && Model.UploadSession != null) { %>
        <p>Result: <%=Model.UploadSession.State%></p>
        <% if (Model.UploadSession.State != UploadState.Error) { %>
        <p>Files Uploaded: <%=Model.UploadSession.UploadedFiles.Count.ToString()%></p>

    <table class="results" width="99%" cellpadding="4" cellspacing="0">
        <thead>
            <tr>
                <th align="left">
                    Server Location
                </th>
                <th align="left">
                    Mime Type
                </th>
                <th align="left">
                    Length (bytes)
                </th>
            </tr>
        </thead>
        <tbody>
            <% foreach (UploadedFile file in Model.UploadSession.UploadedFiles) {%>
            <tr>
                <td>
                    <%=file.ServerLocation.Replace("\\", "\\<wbr />") %>
                </td>
                <td>
                    <%=file.ContentType %>
                </td>
                <td>
                    <%=file.ContentLength %>
                </td>
            </tr>
            <% } %>
        </tbody>
    </table>
        <% } else { %>
        <p>Error Type: <%=Model.UploadSession.ErrorType %></p>
        <% } %>
    <% } else { %>
    <p>No upload recieved.</p>
    <% } %>
    <p>
        <% using (Html.BeginForm("Index", "Home", FormMethod.Post, new { id = "settingsForm" })) { %>
            <%=Html.HiddenFor(x => x.MaxFiles)%>
            <%=Html.HiddenFor(x => x.RequireFileSelection)%>
            <%=Html.HiddenFor(x => x.ConfirmNavigateMessage)%>
            <%=Html.HiddenFor(x => x.ValidExtensions)%>
            <%=Html.HiddenFor(x => x.FileTypeMessage)%>
            <%=Html.HiddenFor(x => x.MaxFileSize)%>
            <%=Html.HiddenFor(x => x.FileSizeMessage)%>
            <%=Html.HiddenFor(x => x.SummaryMessage)%>
            <a href="javascript:;" class="button" onclick="document.getElementById('settingsForm').submit()">
                <span><b class="icon newupload"></b> New Upload</span>
            </a>
        <% } %>
        <div style="clear:both"></div>
    </p>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="description" runat="server">
    <p>This sample demonstrates the basics of SlickUpload including file selection, maximum files limits, maximum file size limits, file type validation, requiring file selection.</p>
</asp:Content>